﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace Readify.Management.Automation.GoGrid
{
    public class GoGridIPAddress
    {
        internal static GoGridIPAddress CreateFromXmlNode(XmlNode objectElementNode)
        {
            GoGridIPAddress output = new GoGridIPAddress();
            output.ID = GoGridHelper.GetAttributeElementValueFromXmlNodeAsNullableInt32(objectElementNode, "id");
            output.IPAddress = GoGridHelper.GetAttributeElementValueFromXmlNodeAsString(objectElementNode, "ip");
            output.Subnet = GoGridHelper.GetAttributeElementValueFromXmlNodeAsString(objectElementNode, "subnet");
            output.IsPublic = GoGridHelper.GetAttributeElementValueFromXmlNodeAsBoolean(objectElementNode, "public");

            return output;
        }

        public int? ID { get; set; }
        public string IPAddress { get; set; }
        public string Subnet { get; set; }
        public bool IsPublic { get; set; }

        public override string ToString()
        {
            return this.IPAddress;
        }
    }
}
